package com.licq.ldoc.scanner;

import java.io.IOException;
import java.util.Collection;

import org.apache.commons.lang.StringUtils;

import com.derbysoft.modules.resource.ClassFinder;
import com.derbysoft.modules.resource.impl.ResourceProbeBasedClassFinder;

public class ClassScanner implements ClassProvider {
	private String classPattern;
	
	private ClassFinder classFinder = new ResourceProbeBasedClassFinder();

    public ClassScanner(String classPattern) {
    	if (StringUtils.isBlank(classPattern)) {
    		throw new IllegalArgumentException("argument classPattern cannot be blank.");
    	}
    	this.classPattern = classPattern;
    }

    public Collection<Class<?>> fetch() throws ClassNotFoundException, IOException {
    	return classFinder.findClass(classPattern);
    }
}

